﻿using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using OpenAdmin.Core.DbContextLocators;

namespace OpenAdmin.Core.Models;

/// <summary>
/// 权限-菜单关系表
/// </summary>
[Table("SysPermissionMenu")]
public class SysPermissionMenu : EntityRelation<ApplicationDbContextLocator>, IEntityTypeConfigure<SysPermissionMenu, ApplicationDbContextLocator>
{
    /// <summary>
    /// 权限Id
    /// </summary>
    public int PermissionId { get; set; }
    /// <summary>
    /// 菜单Id
    /// </summary>
    public int MenuId { get; set; }

    public void Configure(EntityTypeBuilder<SysPermissionMenu> entityBuilder)
    {
        entityBuilder.HasKey(t => new { t.PermissionId, t.MenuId });
    }
}
